#ifndef __BSP_LED_H
#define __BSP_LED_H

#include "public.h"

sbit SEG_A = P0^5;
sbit SEG_B = P0^6;
sbit SEG_C = P0^7;
sbit SEG_D = P1^0;
sbit SEG_E = P1^1;
sbit SEG_F = P4^7;
sbit SEG_G = P1^4;
sbit SEG_H = P1^5;
sbit SEG_I = P1^6;
sbit SEG_J = P1^7;

sbit line1 = P5^3;
sbit line2 = P1^3;
sbit line3 = P5^4;
sbit line4 = P4^0;
sbit line5 = P3^2;
sbit line6 = P3^3;

#define LED1(n)    if(n) {SEG_A = 1;line1 = 0;}else {SEG_A = 0;line1 = 1;}
#define LED2(n)    if(n) {SEG_B = 1;line1 = 0;}else {SEG_B = 0;line1 = 1;}
#define LED3(n)    if(n) {SEG_C = 1;line1 = 0;}else {SEG_C = 0;line1 = 1;}
#define LED4(n)    if(n) {SEG_D = 1;line1 = 0;}else {SEG_D = 0;line1 = 1;}
#define LED5(n)    if(n) {SEG_E = 1;line1 = 0;}else {SEG_E = 0;line1 = 1;}
#define LED6(n)    if(n) {SEG_F = 1;line1 = 0;}else {SEG_F = 0;line1 = 1;}
#define LED7(n)    if(n) {SEG_G = 1;line1 = 0;}else {SEG_G = 0;line1 = 1;}
#define LED8(n)    if(n) {SEG_H = 1;line1 = 0;}else {SEG_H = 0;line1 = 1;}
#define LED9(n)    if(n) {SEG_I = 1;line1 = 0;}else {SEG_I = 0;line1 = 1;}
#define LED10(n)   if(n) {SEG_J = 1;line1 = 0;}else {SEG_J = 0;line1 = 1;}

#define LED11(n)   if(n) {SEG_A = 1;line2 = 0;}else {SEG_A = 0;line2 = 1;}
#define LED12(n)   if(n) {SEG_B = 1;line2 = 0;}else {SEG_B = 0;line2 = 1;}
#define LED13(n)   if(n) {SEG_C = 1;line2 = 0;}else {SEG_C = 0;line2 = 1;}
#define LED14(n)   if(n) {SEG_D = 1;line2 = 0;}else {SEG_D = 0;line2 = 1;}
#define LED15(n)   if(n) {SEG_E = 1;line2 = 0;}else {SEG_E = 0;line2 = 1;}
#define LED16(n)   if(n) {SEG_F = 1;line2 = 0;}else {SEG_F = 0;line2 = 1;}
#define LED17(n)   if(n) {SEG_G = 1;line2 = 0;}else {SEG_G = 0;line2 = 1;}
#define LED18(n)   if(n) {SEG_H = 1;line2 = 0;}else {SEG_H = 0;line2 = 1;}
#define LED19(n)   if(n) {SEG_I = 1;line2 = 0;}else {SEG_I = 0;line2 = 1;}
#define LED20(n)   if(n) {SEG_J = 1;line2 = 0;}else {SEG_J = 0;line2 = 1;}

#define LED21(n)   if(n) {SEG_A = 1;line3 = 0;}else {SEG_A = 0;line3 = 1;}
#define LED22(n)   if(n) {SEG_B = 1;line3 = 0;}else {SEG_B = 0;line3 = 1;}
#define LED23(n)   if(n) {SEG_C = 1;line3 = 0;}else {SEG_C = 0;line3 = 1;}
#define LED24(n)   if(n) {SEG_D = 1;line3 = 0;}else {SEG_D = 0;line3 = 1;}
#define LED25(n)   if(n) {SEG_E = 1;line3 = 0;}else {SEG_E = 0;line3 = 1;}
#define LED26(n)   if(n) {SEG_F = 1;line3 = 0;}else {SEG_F = 0;line3 = 1;}
#define LED27(n)   if(n) {SEG_G = 1;line3 = 0;}else {SEG_G = 0;line3 = 1;}
#define LED28(n)   if(n) {SEG_H = 1;line3 = 0;}else {SEG_H = 0;line3 = 1;}
#define LED29(n)   if(n) {SEG_I = 1;line3 = 0;}else {SEG_I = 0;line3 = 1;}
#define LED30(n)   if(n) {SEG_J = 1;line3 = 0;}else {SEG_J = 0;line3 = 1;}

#define LED31(n)   if(n) {SEG_A = 1;line4 = 0;}else {SEG_A = 0;line4 = 1;}
#define LED32(n)   if(n) {SEG_B = 1;line4 = 0;}else {SEG_B = 0;line4 = 1;}
#define LED33(n)   if(n) {SEG_C = 1;line4 = 0;}else {SEG_C = 0;line4 = 1;}
#define LED34(n)   if(n) {SEG_D = 1;line4 = 0;}else {SEG_D = 0;line4 = 1;}
#define LED35(n)   if(n) {SEG_E = 1;line4 = 0;}else {SEG_E = 0;line4 = 1;}
#define LED36(n)   if(n) {SEG_F = 1;line4 = 0;}else {SEG_F = 0;line4 = 1;}
#define LED37(n)   if(n) {SEG_G = 1;line4 = 0;}else {SEG_G = 0;line4 = 1;}
#define LED38(n)   if(n) {SEG_H = 1;line4 = 0;}else {SEG_H = 0;line4 = 1;}
#define LED39(n)   if(n) {SEG_I = 1;line4 = 0;}else {SEG_I = 0;line4 = 1;}
#define LED40(n)   if(n) {SEG_J = 1;line4 = 0;}else {SEG_J = 0;line4 = 1;}

#define LED41(n)   if(n) {SEG_A = 1;line5 = 0;}else {SEG_A = 0;line5 = 1;}
#define LED42(n)   if(n) {SEG_B = 1;line5 = 0;}else {SEG_B = 0;line5 = 1;}
#define LED43(n)   if(n) {SEG_C = 1;line5 = 0;}else {SEG_C = 0;line5 = 1;}
#define LED44(n)   if(n) {SEG_D = 1;line5 = 0;}else {SEG_D = 0;line5 = 1;}
#define LED45(n)   if(n) {SEG_E = 1;line5 = 0;}else {SEG_E = 0;line5 = 1;}
#define LED46(n)   if(n) {SEG_F = 1;line5 = 0;}else {SEG_F = 0;line5 = 1;}
#define LED47(n)   if(n) {SEG_G = 1;line5 = 0;}else {SEG_G = 0;line5 = 1;}
#define LED48(n)   if(n) {SEG_H = 1;line5 = 0;}else {SEG_H = 0;line5 = 1;}
#define LED49(n)   if(n) {SEG_I = 1;line5 = 0;}else {SEG_I = 0;line5 = 1;}
#define LED50(n)   if(n) {SEG_J = 1;line5 = 0;}else {SEG_J = 0;line5 = 1;}

#define LED51(n)   if(n) {SEG_A = 1;line6 = 0;}else {SEG_A = 0;line6 = 1;}
#define LED52(n)   if(n) {SEG_B = 1;line6 = 0;}else {SEG_B = 0;line6 = 1;}
#define LED53(n)   if(n) {SEG_C = 1;line6 = 0;}else {SEG_C = 0;line6 = 1;}
#define LED54(n)   if(n) {SEG_D = 1;line6 = 0;}else {SEG_D = 0;line6 = 1;}
#define LED55(n)   if(n) {SEG_E = 1;line6 = 0;}else {SEG_E = 0;line6 = 1;}
#define LED56(n)   if(n) {SEG_F = 1;line6 = 0;}else {SEG_F = 0;line6 = 1;}
#define LED57(n)   if(n) {SEG_G = 1;line6 = 0;}else {SEG_G = 0;line6 = 1;}
#define LED58(n)   if(n) {SEG_H = 1;line6 = 0;}else {SEG_H = 0;line6 = 1;}
#define LED59(n)   if(n) {SEG_I = 1;line6 = 0;}else {SEG_I = 0;line6 = 1;}
#define LED60(n)   if(n) {SEG_J = 1;line6 = 0;}else {SEG_J = 0;line6 = 1;}

void LED_GPIO_Config(void);
void LED_ShowTime(void);
void close_all_led(void);

#endif
